import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { StepRecordVO, StepRecordForm, StepRecordQuery } from '@/leadmall/api/stepRecord/types';

/**
 * 查询阶段步骤记录列表
 * @param query
 * @returns {*}
 */

export const listStepRecord = (query?: StepRecordQuery): AxiosPromise<StepRecordVO[]> => {
  return request({
    url: PORT +'/leadmall/stepRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询阶段步骤记录详细
 * @param id
 */
export const getStepRecord = (id: string | number): AxiosPromise<StepRecordVO> => {
  return request({
    url: PORT +'/leadmall/stepRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增阶段步骤记录
 * @param data
 */
export const addStepRecord = (data: StepRecordForm) => {
  return request({
    url: PORT +'/leadmall/stepRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改阶段步骤记录
 * @param data
 */
export const updateStepRecord = (data: StepRecordForm) => {
  return request({
    url: PORT +'/leadmall/stepRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除阶段步骤记录
 * @param id
 */
export const delStepRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/stepRecord/' + id,
    method: 'delete'
  });
};
